using PaulRz.Util.Patterns;

namespace PaulRz.Util.Patterns
{
    /// <summary>
    /// This producer generates the message by direct call of AcceptMessage.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class SimpleProducer<T> : ProducerPipelineElement<T>
        where T : class
    {
        /// <summary>
        /// Standard constructor
        /// </summary>
        /// <param name="name"></param>
        /// <param name="logger"></param>
        /// <param name="joinTime"></param>
        public SimpleProducer(string name, ILogInterface logger, int joinTime) : base(name, logger, joinTime)
        {
        }

        protected override T ReceiveMessage()
        {
            return default(T);
        }
        
        public void AcceptMessage(T message)
        {
            Output.Enqueue(message);
        }
        
        public override void Start()
        {
            Output.Start();
        }

        public override void Stop()
        {
            Output.Stop();
        }
    }
}
